import 'package:flutter/material.dart';
import 'package:flutter/services.dart';
import 'package:flutter_app/application.dart';
import 'package:flutter_app/constant.dart';
import 'package:flutter_app/pages/splash_page.dart';
import 'package:flutter_app/routers/router_utils.dart';
import 'package:flutter_app/utils/device_utils.dart';
import 'package:flutter_app/utils/http_utils.dart';
import 'package:oktoast/oktoast.dart';
import 'http/http_manager.dart';
import 'package:sp_util/sp_util.dart';

void main() async {
  runApp(MyApp());
  if (Device.isAndroid) {
    var style = SystemUiOverlayStyle(
        statusBarColor: Colors.transparent,
        statusBarIconBrightness: Brightness.dark);
    SystemChrome.setSystemUIOverlayStyle(style);
  }
  /// sp初始化
  await SpUtil.getInstance();
  Application.httpUtils = HttpUtils(Constant.API_HOST);
  HttpManager().init(baseUrl: Constant.API_HOST);
  RouterUtils.initRouter();
}

class MyApp extends StatelessWidget {
  @override
  Widget build(BuildContext context) {
    return OKToast(
        child:
            MaterialApp(debugShowCheckedModeBanner: false, home: SplashPage()));
  }
}
